<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 用户可以选择存钱，取钱，查看余额和退出功能 -->
    <script>
        // 1.设置变量，获取用户选项
        // let choose = +prompt("1.存钱"+'\n'+"2.取钱"+'\n'+"3.查看余额:\n"+"4.退出：")
        let money = 0
        let Withdraw_money = 0
        let balance = 0
       while(true){
        let choose = +prompt("1.存钱"+'\n'+"2.取钱"+'\n'+"3.查看余额:\n"+"4.退出：")
        if (choose ===1){
            money = +prompt('请输入存款金额：')
            continue
        }else if (choose ===2){
            Withdraw_money = +prompt('请输入取款金额：')
            if(Withdraw_money <= money){
                alert('取款成功')
                money = money - Withdraw_money
            }else {
                alert('余额不足')
            }
            continue
        }else if(choose === 3){
            // balance = money - Withdraw_money
            alert(`账户余额为${money}`)
            continue
        }else if (choose ===4){
            let str = prompt('确认退出吗？')
            if (str === '确认'){
                break
            }
            continue
        }else {
            alert('请输入正确的选项')
            continue
        }
       }
    </script>
</body>
</html>